package com.syf.starter.config;

import com.syf.core.engine.SyFrameContext;
import com.syf.kit.soa.SOARegionDocument;
import com.syf.starter.soa.SySOAServer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(SySOAServerConfiguration.class)
public class SySOAStarterAutoConfig {

    @ConditionalOnBean(SOARegionDocument.class)
    @Bean(name = "soa-service-server")
    SySOAServer createSySOAServer(SySOAServerConfiguration configuration, SyFrameContext syFrameContext, SOARegionDocument soaRegionDoc) {
        return new SySOAServer(configuration, syFrameContext, soaRegionDoc);
    }
}
